package HLLibClasses;

import HLCode.HLClassManager;
import HLCode.HLLibClass;
import HLCode.HLObject;
import HLLib.base.HLDictionary;
import HLLib.base.HLString;

public class HLClassDictionary extends HLLibClass {
    public HLClassDictionary(HLClassManager owner) {
        super(owner);
    }

    public HLObject NewObject() {
        return new HLDictionary();
    }

    public void Execute(HLObject self, int index, HLObject args, HLObject resultOwnerObject, int resultIndex) {
        switch (index) {
        case 0: {
            if (resultOwnerObject == null) {
                ((HLDictionary) self).Count();
            } else {
                resultOwnerObject.SetInt(resultIndex, ((HLDictionary) self).Count());
            }
            break;
        }
        case 1: {
            if (resultOwnerObject == null) {
                ((HLDictionary) self).GetItem((HLString)args.GetObject(0));
            } else {
                resultOwnerObject.SetObject(resultIndex, ((HLDictionary) self).GetItem((HLString)args.GetObject(0)));
            }
            break;
        }
        case 2: {
            ((HLDictionary) self).Put((HLString)args.GetObject(0), (HLObject)args.GetObject(1));
            break;
        }
        case 3: {
            ((HLDictionary) self).Clear();
            break;
        }
        case 4: {
            if (resultOwnerObject == null) {
                ((HLDictionary) self).ContainsKey((HLString)args.GetObject(0));
            } else {
                resultOwnerObject.SetBoolean(resultIndex, ((HLDictionary) self).ContainsKey((HLString)args.GetObject(0)));
            }
            break;
        }
        case 5: {
            if (resultOwnerObject == null) {
                ((HLDictionary) self).ContainsValue((HLObject)args.GetObject(0));
            } else {
                resultOwnerObject.SetBoolean(resultIndex, ((HLDictionary) self).ContainsValue((HLObject)args.GetObject(0)));
            }
            break;
        }
        case 6: {
            ((HLDictionary) self).Remove((HLString)args.GetObject(0));
            break;
        }
        case 7: {
            if (resultOwnerObject == null) {
                ((HLDictionary) self).GetKeys();
            } else {
                resultOwnerObject.SetObject(resultIndex, ((HLDictionary) self).GetKeys());
            }
            break;
        }
        case 8: {
            if (resultOwnerObject == null) {
                ((HLDictionary) self).GetValues();
            } else {
                resultOwnerObject.SetObject(resultIndex, ((HLDictionary) self).GetValues());
            }
            break;
        }
        }
    }
}
